/*
 * Copyright 2012 Fabian Wenzelmann
 * 
 * This file is part of Recognition-Procedures-for-Boolean-Functions.
 * 
 * Recognition-Procedures-for-Boolean-Functions is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Recognition-Procedures-for-Boolean-Functions is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Recognition-Procedures-for-Boolean-Functions.  If not, see <http://www.gnu.org/licenses/>.
 */
/*
 * Copyright 2012 Fabian Wenzelmann
 * 
 * This file is part of Recognition-Procedures-for-Boolean-Functions.
 * 
 * Recognition-Procedures-for-Boolean-Functions is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Recognition-Procedures-for-Boolean-Functions is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Recognition-Procedures-for-Boolean-Functions.  If not, see <http://www.gnu.org/licenses/>.
 */

package de.wenzelmf.booleanFunction.util;

import java.util.Collection;
import java.util.LinkedList;

/**
 * An implementation of the {@link IStack} interface that just extends the Java LinkedList
 * because it already defines all required methods.
 * 
 * @author Fabian Wenzelmann
 * @version 1.0
 *
 * @param <T> Type of the elements in the stack.
 */
public class LinkedListStack<T> extends LinkedList<T> implements IStack<T>
{

	private static final long serialVersionUID = -2934258864887378333L;

	@Override
	public boolean empty()
	{
		return isEmpty();
	}

	/**
	 * Creates a new empty LinkedListStack.
	 */
	public LinkedListStack()
	{
		super();
	}
	
	/**
	 * Creates a new LinkedListStack, calls {@link #pushAll(Collection)} to
	 * add all elements from the collection.
	 * 
	 * @param c The elements the new created stack contains.
	 */
	public LinkedListStack(Collection<T> c)
	{
		pushAll(c);
	}
	
	@Override
	public void pushAll(Collection<? extends T> c)
	{
		for(T e : c)
		{
			push(e);
		}
	}
	
}
